FilesContentsFigures, Tables, and ListingsAbout This BookFormat of a Typical ChapterConventions Used in This BookSpecial FontsTypes of NotesAssembly-Language InformationDevelopment Environment Introduction to File ManagementAbout Files
File Forks,Figure 1-1 The two forks of a Macintosh file File Size/Figure 1-2 Logical blocks and allocation blocks7Figure 1-3 Logical end-of-file and physical end-of-fileFile Access CharacteristicsThe Hierarchical File System1Figure 1-4 The Macintosh hierarchical file system%Figure 1-5 The disk switch dialog box!Identifying Files and DirectoriesUsing FilesFigure 1-6 A typical File menu+Listing 1-1 Handling the File menu commands$Testing for File Management RoutinesSListing 1-2 Testing for the availability of routines that operate on FSSpec recordsDefining a Document Record$Listing 1-3 A sample document recordCreating a New File)Listing 1-4 Handling the New menu command*Listing 1-5 Creating a new document windowOpening a File*Listing 1-6 Handling the Open menu command&Figure 1-7 The default Open dialog boxListing 1-7 Opening a fileReading File Data$Listing 1-8 Reading data from a fileWriting File Data$Listing 1-9 Writing data into a file#Listing 1-10 Updating a file safelySaving a File+Listing 1-11 Handling the Save menu command.Listing 1-12 Handling the Save As menu command&Figure 1-8 The default Save dialog box$Figure 1-9 The new folder dialog box(Figure 1-10 The name conflict dialog boxAListing 1-13 Copying a resource from one resource fork to anotherReverting to a Saved File(Figure 1-11 A Revert to Saved dialog box6Listing 1-14 Handling the Revert to Saved menu commandClosing a File,Listing 1-15 Handling the Close menu commandListing 1-16 Closing a file)Opening Files at Application Startup Time5Listing 1-17 Opening files at application launch timeUsing a Preferences File'Listing 1-18 Opening a preferences fileAdjusting the File Menu$Listing 1-19 Adjusting the File menuFile Management ReferenceData Structures File System Specification RecordStandard File Reply RecordsApplication Files RecordsFile Specification RoutinesStandardGetFileStandardPutFileFile Access Routines#Reading, Writing, and Closing FilesFSReadFSWriteFSCloseManipulating the File MarkGetFPosSetFPosManipulating the End-of-FileGetEOFSetEOF(File and Directory Manipulation Routines%Opening, Creating, and Deleting Files FSpOpenDF FSpCreate FSpDelete Exchanging the Data in Two FilesFSpExchangeFiles#Creating File System SpecificationsFSMakeFSSpecVolume Access RoutinesUpdating VolumesFlushVolObtaining Volume InformationGetVInfo
GetVRefNum Application Launch File RoutinesGetAppParmsCountAppFilesGetAppFilesClrAppFilesSummary of File ManagementFile ManagerAbout the File ManagerFile Manipulation)Table 2-1 Routines for opening file forks3Table 2-2 Routines for operating on open file forks0Table 2-3 Routines for operating on closed filesDirectory Manipulation/Table 2-4 Routines for operating on directories7Table 2-5 Routines for manipulating working directoriesVolume Manipulation+Table 2-6 Routines for operating on volumesVolume Searching7Table 2-7 Routines for manipulating working directoriesShared Environments%Table 2-8 Shared environment routinesShared File Access Permissions/Figure 2-1 Access and deny mode synchronization!Table 2-9 Access mode translationDirectory Access Privileges@Figure 2-2 Access privileges information in the ioACAccess fieldRemote Volume Mounting-Privilege Information in Foreign File SystemsFile ID Reference Routines+Identifying Files, Directories, and VolumesFile System SpecificationsFile IDsDirectory IDsVolume Reference Numbers#Working Directory Reference NumbersNames and PathnamesHFS Specifications$Figure 2-3 Identifying a file in HFSSearch PathsUsing the File Manager,Determining the Features of the File Manager#Listing 2-1 Testing for PBCatSearch*Creating File System Specification Records5Table 2-10 How FSMakeFSSpec interprets its parameters-Manipulating the Default Volume and DirectoryDeleting Files and File Forks+Listing 2-2 Deleting a file’s resource forkSearching a VolumeDTable 2-11 Fields in ioSearchInfo1 and ioSearchInfo2 used for a fileITable 2-12 Fields in ioSearchInfo1 and ioSearchInfo2 used for a directory/Listing 2-3 Searching a volume with PBCatSearch@Listing 2-4 Searching a volume using a recursive, indexed searchConstructing Full Pathnames4Listing 2-5 Constructing the full pathname of a file0Determining the Amount of Free Space on a Volume<Listing 2-6 Determining the amount of free space on a volumeSharing Volumes and Directories4Listing 2-7 Determining whether a volume is sharable7Listing 2-8 Determining whether file sharing is enabled!Locking and Unlocking File Ranges=Listing 2-9 Determining whether a file can have ranges locked<Listing 2-10 Locking a file range to append data to the fileData Organization on VolumesDisk and Volume Organization/Figure 2-4 Organization of partitions on a disk#Figure 2-5 Organization of a volumeBoot BlocksMaster Directory BlocksVolume BitmapsB*-Trees*Figure 2-6 The structure of a B*-tree fileNodes"Figure 2-7 The structure of a nodeNode Records-Figure 2-8 Structure of a B*-tree node recordFigure 2-9 A sample B*-treeHeader Nodes!Figure 2-10 Header node structure Map NodesIndex Nodes
Leaf NodesCatalog FilesCatalog File KeysCatalog File Data RecordsExtents Overflow FilesData Organization in MemoryThe File I/O QueueVolume Control BlocksFile Control BlocksB*-Tree Control BlocksThe Drive Queue7Listing 2-11 Reading a drive queue element’s flag bytesFile Manager ReferenceData Structures File System Specification Record"Basic File Manager Parameter BlockHFS Parameter Block$Catalog Information Parameter BlocksCatalog Position RecordsCatalog Move Parameter Blocks"Working Directory Parameter Blocks#File Control Block Parameter BlocksVolume Attributes Buffer#Volume Mounting Information RecordsHigh-Level File Access Routines#Reading, Writing, and Closing FilesFSReadFSWriteFSCloseManipulating the File MarkGetFPosSetFPosManipulating the End-of-FileGetEOFSetEOFAllocating File BlocksAllocateAllocContigLow-Level File Access Routines#Reading, Writing, and Closing FilesPBReadPBWritePBCloseManipulating the File Mark PBGetFPos PBSetFPosManipulating the End-of-FilePBGetEOFPBSetEOFAllocating File Blocks
PBSetVInfoPBHGetVolParmsManipulating the Default VolumePBGetVolPBSetVol PBHGetVol PBHSetVol"File System Specification RoutinesOpening Files FSpOpenDF FSpOpenRF+Creating and Deleting Files and Directories FSpCreateFSpDirCreate FSpDelete1Accessing Information About Files and DirectoriesFSpGetFInfoFSpSetFInfoFSpSetFLockFSpRstFLock FSpRenameMoving Files or Directories
FSpCatMove Exchanging the Data in Two FilesFSpExchangeFiles#Creating File System SpecificationsFSMakeFSSpecPBMakeFSSpecHigh-Level HFS RoutinesOpening FilesHOpenDFHOpenRFHOpen+Creating and Deleting Files and DirectoriesHCreate DirCreateHDelete1Accessing Information About Files and Directories HGetFInfo HSetFInfo HSetFLock HRstFLockHRenameMoving Files or DirectoriesCatMoveMaintaining Working DirectoriesOpenWDCloseWD GetWDInfoLow-Level HFS RoutinesOpening Files PBHOpenDF PBHOpenRFPBHOpen+Creating and Deleting Files and Directories PBHCreatePBDirCreate PBHDelete1Accessing Information About Files and DirectoriesPBGetCatInfoPBSetCatInfoPBHGetFInfoPBHSetFInfoPBHSetFLockPBHRstFLock PBHRenameMoving Files or Directories PBCatMoveMaintaining Working DirectoriesPBOpenWD PBCloseWDPBGetWDInfoSearching a CatalogPBCatSearch Exchanging the Data in Two FilesPBExchangeFilesShared Environment Routines"Opening Files While Denying AccessPBHOpenDenyPBHOpenRFDeny!Locking and Unlocking File RangesPBLockRangePBUnlockRangeManipulating Share PointsPBShare PBUnsharePBGetUGEntryControlling Directory AccessPBHGetDirAccessPBHSetDirAccessMounting VolumesPBGetVolMountInfoSizePBGetVolMountInfoPBVolumeMountControlling Login AccessPBHGetLogInInfoPBHMapID
PBHMapNameCopying and Moving FilesPBHCopyFilePBHMoveRenameFile ID RoutinesResolving File ID ReferencesPBResolveFileIDRef(Creating and Deleting File ID ReferencesPBCreateFileIDRefPBDeleteFileIDRefForeign File System RoutinesPBGetForeignPrivsPBSetForeignPrivsUtility RoutinesObtaining Queue Headers GetFSQHdr
GetVCBQHdr
GetDrvQHdrAdding a DriveAddDrive(Obtaining File Control Block InformationPBGetFCBInfoApplication-Defined RoutinesCompletion RoutinesMyCompletionProcSummary of the File ManagerStandard File PackageAbout the Standard File PackageStandard User InterfacesOpening Files&Figure 3-1 The default Open dialog boxSaving Files&Figure 3-2 The default Save dialog box$Figure 3-3 The New Folder dialog box'Figure 3-4 The name conflict dialog boxKeyboard EquivalentsCustomized User InterfacesSaving Files<Figure 3-5 The Save dialog box customized with radio buttons<Figure 3-6 The Save dialog box customized with a pop-up menuOpening Files<Figure 3-7 The Open dialog box customized with a pop-up menu!Selecting Volumes and DirectoriesKFigure 3-8 The Open dialog box customized to allow selection of a directory<Figure 3-9 The Open dialog box when no directory is selectedFFigure 3-10 The Open dialog box with a long directory name abbreviated)Figure 3-11 A volume selection dialog boxUser Interface GuidelinesUsing the Standard File Package&Presenting the Standard User Interface*Listing 3-1 Handling the Open menu command0Listing 3-2 Specifying more than four file typesCustomizing the User Interface3Listing 3-3 Presenting a customized Open dialog boxCustomizing Dialog Boxes9Listing 3-4 The definition of the default Open dialog box9Listing 3-5 The definition of the default Save dialog box9Listing 3-6 The item list for the default Open dialog box9Listing 3-7 The item list for the default Save dialog boxWriting a File Filter Function)Listing 3-8 A sample file filter functionWriting a Dialog Hook Function)Listing 3-9 A sample dialog hook function&Writing a Modal-Dialog Filter Function2Listing 3-10 A sample modal-dialog filter functionWriting an Activation ProcedureSetting the Current Directory.Listing 3-11 Determining the current directory+Listing 3-12 Determining the current volume*Listing 3-13 Setting the current directory'Listing 3-14 Setting the current volume*Listing 3-15 Setting the current directorySelecting a Directory?Listing 3-16 A file filter function that lists only directories%Listing 3-17 Setting a button’s titleKListing 3-18 Handling user selections in the directory selection dialog box:Listing 3-19 Presenting the directory selection dialog boxSelecting a Volume;Listing 3-20 A file filter function that lists only volumesHListing 3-21 Handling user selections in the volume selection dialog box7Listing 3-22 Presenting the volume selection dialog boxUsing the Original ProceduresStandard File Package ReferenceData Structures#Enhanced Standard File Reply Record#Original Standard File Reply RecordStandard File Package RoutinesSaving FilesStandardPutFileCustomPutFile SFPutFile
SFPGetFileApplication-Defined RoutinesFile Filter FunctionsMyStandardFileFilterMyCustomFileFilterDialog Hook Functions MyDlgHookModal-Dialog Filter FunctionsMyModalFilterMyModalFilterYDActivation ProceduresMyActivateProc%Summary of the Standard File PackageAlias ManagerAbout the Alias ManagerAlias RecordsSearch StrategiesRelative Searches$Figure 4-1 Resolving a relative pathAbsolute SearchesFast SearchesExhaustive SearchesUsing the Alias ManagerCreating Alias Records$Listing 4-1 Creating an alias recordResolving Alias RecordsIdentifying a Single TargetIdentifying Multiple TargetsMaintaining Alias Records1Listing 4-2 Storing an alias record as a resource&Getting Information From Alias RecordsCustomizing Alias RecordsAlias Manager ReferenceData StructuresAlias RecordsAlias Manager Routines#Creating and Updating Alias Records#Resolving and Reading Alias RecordsApplication-Defined RoutinesFiltering Possible TargetsSummary of the Alias ManagerDisk Initialization Manager%About the Disk Initialization ManagerDisk Initialization&The Disk Initialization User Interface-Figure 5-1 The disk initialization dialog boxCFigure 5-2 Alternate buttons for the disk initialization dialog box*Figure 5-3 The disk initialization warning%Figure 5-4 The disk naming dialog box/Figure 5-5 The Finder’s disk erasing dialog boxBad Block Sparing%Using the Disk Initialization Manager"Responding to Disk-Inserted Events.Listing 5-1 Responding to disk-inserted eventsErasing Initialized Disks'Listing 5-2 Reinitializing a valid disk0Overriding the Standard Initialization InterfaceXListing 5-3 Reinitializing a validly formatted disk without using the standard interfaceSListing 5-4 Initializing an uninitialized disk without using the standard interface'Changing Default Volume Characteristics3Listing 5-5 Changing default volume characteristics%Disk Initialization Manager ReferenceRoutines5Loading and Unloading the Disk Initialization ManagerDILoadDIUnloadInitializing a Disk
DIBadMount&Low-Level Disk Initialization RoutinesDIFormatDIVerifyDIZero+Summary of the Disk Initialization ManagerGlossaryIndex